/*
 * @Author: xiezh 602666178@qq.com
 * @Date: 2022-12-13 08:39:40
 * @LastEditors: xiezh
 * @LastEditTime: 2022-12-13 09:28:20
 * @Description: file content
 */

const router = require('koa-router')()

router.get('/', async (ctx, next) => {
  await ctx.render('index', {
    title: 'Hello Koa 2!'
  })
})

router.get('/string', async (ctx, next) => {
  ctx.body = 'koa2 string'
})

router.get('/json', async (ctx, next) => {
  ctx.body = {
    title: 'koa2 json'
  }
})
router.post('/login', async (ctx, next) => {
  const params = ctx.request
  console.log('params', params);
  console.log('params', params.body);
  
  ctx.body = {
    title: 'koa2 json'
  }
})

module.exports = router
